use thiserror::Error;

use stencil_tysys::UserTypeId;

use crate::FieldType;

#[derive(Debug, Error)]
pub enum Error {
    #[error("tried to pad to earlier position (at {0}, to {0})")]
    PadBeforePos(usize, usize),

    #[error("unsupported field type {0:?}")]
    UnsupportedFieldType(FieldType),

    #[error("struct '{0}' referenced before definition")]
    StructRefBeforeDef(String),

    #[error("struct ID '{0:?}' referenced before definition")]
    StructIdRefBeforeDef(UserTypeId),

    #[error("unsupported array field type: {0:?}")]
    UnsupportedArrayFieldType(FieldType),

    #[error("not yet implemented")]
    Unimplmented,

    #[error("{0}")]
    Other(String),
}
